require 'jcode'
$KCODE = 'UTF8'
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def time_string(number)
    if number < 60 then
      return pluralize(number, 'second')
    elsif (number / 60) < 60 then
      return pluralize(number / 60, 'minute')
    elsif (number / (60 * 60)) < 24 then 
      return pluralize((number / (60 * 60)), 'hour')
    elsif (number / (60 * 60 * 24)) < 365 then
      return pluralize((number / (60 * 60 * 24)), 'day')
    else
      return pluralize((number / (60 * 60 * 24 * 365)), 'year')
    end
  end  
end
